package com.huluobo.a2207douyindemo.home;

import androidx.lifecycle.MutableLiveData;

import com.huluobo.base.bean.BannerBeanResult;
import com.huluobo.base.bean.VideoBeanResult;
import com.huluobo.base.mvvm.BaseViewModel;

/**
 * Created by LC on 2024/9/28.
 */
public class HomeViewModel extends BaseViewModel<HomeRepo> {

    MutableLiveData<VideoBeanResult> getHomeVideoSuccess = new MutableLiveData<>();
    MutableLiveData<String> getHomeVideoFailed = new MutableLiveData<>();

    MutableLiveData<BannerBeanResult> getBannerSuccess = new MutableLiveData<>();
    MutableLiveData<String> getBannerFailed = new MutableLiveData<>();

    MutableLiveData<VideoBeanResult> findVideoSuccess = new MutableLiveData<>();
    MutableLiveData<String> findVideoFailed = new MutableLiveData<>();

    public void findVideoByName(String keyword) {
        repo.findVideoByName(keyword, findVideoSuccess, findVideoFailed);
    }

    public void getHomeVideos(int currentPage, int pageSize) {
        repo.getHomeVideos(currentPage, pageSize, getHomeVideoSuccess, getHomeVideoFailed);
    }

    public void getHomeBanner() {
        repo.getHomeBanner(getBannerSuccess, getBannerFailed);
    }

    @Override
    protected HomeRepo createRepo() {
        return new HomeRepo();
    }
}
